#include "Debug.h"
#include "ProjectionShape.h"


ProjectionShape::ProjectionShape(void)
{
}


ProjectionShape::~ProjectionShape(void)
{
}

void ProjectionShape::getUnscaledUVs(MPoint coords, float2 outUVs)
{
}

double ProjectionShape::getWidthToHeightRatio()
{
	return 1;
}


double ProjectionShape::getRightBound()
{
	return rightBound;
}

double ProjectionShape::getLeftBound()
{
	return leftBound;
}


double ProjectionShape::getTopBound()
{
	return topBound;
}

	
double ProjectionShape::getBottomBound()
{
	return bottomBound;
}

void ProjectionShape::setUpBounds()
{
	bottomBound = std::numeric_limits<double>::infinity();	
	topBound = -1 * std::numeric_limits<double>::infinity();	
	leftBound = std::numeric_limits<double>::infinity();	
	rightBound = -1 * std::numeric_limits<double>::infinity();	
}

void ProjectionShape::updateBounds(float2 outUVs)
{
	bottomBound = min(outUVs[1], bottomBound);
	topBound = max(outUVs[1], topBound);
	leftBound = min(outUVs[0], leftBound);
	rightBound = max(outUVs[0], rightBound);	

	widthBounds = abs(rightBound - leftBound);
	heightBounds = abs(topBound - bottomBound);	
}

double ProjectionShape::getHeight()
{
	return heightBounds;
}

double ProjectionShape::getWidth()
{
	return widthBounds;
}